package com.jsb.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.annotation.SystemServiceLog;
import com.jsb.mapper.SysRoleMenuMapper;
import com.jsb.model.SysRoleMenu;
import com.jsb.model.SysRoleMenuExample;

@Service
public class SysRoleMenuService{
	
	@Resource
	private SysRoleMenuMapper sysRoleMenuMapper;
	
	public void addSysRoleMenu(SysRoleMenu sysRoleMenu) {
		sysRoleMenuMapper.insertSelective(sysRoleMenu);
	}
	
	public void delSysRoleMenuById(String id) {
		sysRoleMenuMapper.deleteByPrimaryKey(id);
	}
	
	public void updateSysRoleMenu(SysRoleMenu sysRoleMenu) {
		sysRoleMenuMapper.updateByPrimaryKeySelective(sysRoleMenu);
	}
	
	public void updateSysRoleMenuByExample(SysRoleMenu sysRoleMenu,SysRoleMenuExample sysRoleMenuExample){
	    sysRoleMenuMapper.updateByExampleSelective(sysRoleMenu,sysRoleMenuExample);
	}
	
	public SysRoleMenu getSysRoleMenuById(String id) {
		return sysRoleMenuMapper.selectByPrimaryKey(id);
	}
	//此处为AOP拦截Service记录异常信息。方法不需要加try-catch  
	@SystemServiceLog(description = "查询角色列表") 
	public List<SysRoleMenu> getPageSysRoleMenu(SysRoleMenuExample sysRoleMenuExample) {
		return sysRoleMenuMapper.selectPage(sysRoleMenuExample);
	}
	
	public int countSysRoleMenu(SysRoleMenuExample sysRoleMenuExample) {
		return sysRoleMenuMapper.countByExample(sysRoleMenuExample);
	}
	
	public List<SysRoleMenu> selectByExample(SysRoleMenuExample example){
	    return sysRoleMenuMapper.selectByExample(example);
	}
}
